<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>添加用户</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            background-color: #f4f4f4;
            padding: 20px;
        }

        .form-container {
            max-width: 400px;
            margin: 0 auto;
            background-color: #fff;
            padding: 20px;
            border-radius: 8px;
            box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
        }

        h2 {
            text-align: center;
            color: #333;
        }

        label {
            display: block;
            margin-top: 15px;
            font-weight: bold;
        }

        input[type="text"],
        input[type="email"],
        select {
            width: 100%;
            padding: 8px;
            margin-top: 5px;
            box-sizing: border-box;
            border: 1px solid #ccc;
            border-radius: 4px;
        }

        input[type="radio"] {
            margin-right: 10px;
        }

        .radio-group {
            margin-top: 5px;
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .radio-group input {
            margin-right: 5px;
        }

        button {
            margin-top: 20px;
            width: 100%;
            padding: 10px;
            background-color: #28a745;
            color: white;
            border: none;
            border-radius: 4px;
            font-size: 16px;
            cursor: pointer;
        }

        button:hover {
            background-color: #218838;
        }
    </style>
</head>
<body>

<div class="form-container">
    <h2>添加用户</h2>
    <form method="post" action="{% url 'editUser' user.id %}">
        {% csrf_token %}

        <label for="username">用户名:</label>
        <input type="text" id="username" name="name" value="{{ user.name }}" required>

        <label>性别:</label>
        <div class="radio-group">
            <input type="radio" id="male" name="sex" value="男" {% if user.sex == "男" %}checked{% endif %}>
            <label for="male">男</label>
            <input type="radio" id="female" name="sex" value="女" {% if user.sex == "女" %}checked{% endif %}>
            <label for="female">女</label>
        </div>

        <label for="email">邮箱:</label>
        <input type="email" id="email" name="mail" value="{{ user.mail }}" required>

        <button type="submit">提交</button>
    </form>
</div>

</body>
</html>